package com.interview.a_多线程.d_六种状态.New_Runnable_Terminated;

public class ThreadStatus implements Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 20000; i++) {
            System.out.println(i);
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new ThreadStatus());
        //New 状态
        System.out.println(thread.getState());
        thread.start();

        //可运行  Runnable状态
        System.out.println(thread.getState());

        //还是 可运行  Runnable状态
        Thread.sleep(30);
        System.out.println(thread.getState());

        //结束状态 terminated
        Thread.sleep(2000);
        System.out.println(thread.getState());

    }
}
